import $api from '@/api'

//用户数据列表
export const users = (data) => {
    return $api.get('users', data)
}
//添加用户
export const addUser = (data) => {
    return $api.post('users', data)
}
//修改用户状态
export const userState = (data) => {
    return $api.put(`users/${data.id}/state/${data.mg_state}`)
}
//根据ID查询用户信息
export const userInfo = (data) => {
    return $api.get('users/' + data)
}
//编辑用户提交
export const editUser = (data) => {
    return $api.put('users/' + data.id, {
        email: data.email,
        mobile: data.mobile
      })
}
//删除单个用户
export const delUser = (data) => {
    return $api.del('users/' + data)
}
//分配用户角色
export const setUserRoles = (data) => {
    return $api.put(`users/${data.id}/role`, {
        rid: data.selectRolesId
      })
}

export const userRoles = () => {
    return $api.get('roles')
}